package Data_Structure.Tree;

/**
 * @className: Test2
 * @author: 芃
 * @description: 测试类
 * @date: 2023/8/17 19:54
 */
public class Test2 {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        TreeNode root = binaryTree.createTree();
        System.out.print("前序遍历：");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.print("中序遍历：");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.print("后序遍历：");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.print("树的节点个数：");
        System.out.println(binaryTree.size(root));
        System.out.print("树的叶子节点个数：");
        System.out.println(binaryTree.getLeafNodeCount(root));
        System.out.print("第K层的节点个数：");
        System.out.println(binaryTree.getKLevelNodeCount(root,3));
        System.out.print("获取二叉树的高度：");
        System.out.println(binaryTree.getHeight(root));
        System.out.print("检测值为value的元素是否存在：");
        System.out.println(binaryTree.existNode(root,'O'));
        System.out.print("判断一棵树是不是完全二叉树：");
        System.out.println(binaryTree.isCompleteTree(root));
        System.out.println("层序遍历：");
        binaryTree.levelOrder(root);
    }
}